# -*- coding:utf-8 -*-
class Solution:
    def GetUglyNumber_Solution(self, index):
        # write code here
        if index == 0:
            return 0
        f = [1] * index
        i = 1
        i2 = i3 = i5 = 0
        while i<index:
            minval = min(f[i2]*2,f[i3]*3,f[i5]*5)
            f[i] = minval
            while f[i2]*2<=f[i]:
                i2+=1
            while f[i3]*3<=f[i]:
                i3+=1
            while f[i5]*5<=f[i]:
                i5+=1
            i+=1
        return f[-1]

s=  Solution()
a = s.GetUglyNumber_Solution(1500)
print(a)